<template>
  <div class="left-side">
    <div class="left-side-inner">
      <ul class="menu-box main">

          <el-menu router :default-active="$route.path" class="el-menu-vertical-demo"  @select="getIndex">
          <el-menu-item index="/">
            <i class="el-icon-document"></i>
            <span slot="title">实时监控</span>
          </el-menu-item>

          <el-menu-item index="/currentfilter">
            <i class="el-icon-menu"></i>
            <span slot="title">当前过滤器</span>
          </el-menu-item>

          <el-submenu index="3" @click="openSpreadMenu">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>过滤器配置</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/baseManage/areaManage">黑名单过滤</el-menu-item>
              <el-menu-item index="/baseManage/appManage">白名单过滤</el-menu-item>
            </el-menu-item-group>
          </el-submenu>

          <el-menu-item index="4">
            <i class="el-icon-setting"></i>
            <span slot="title">日志管理</span>
          </el-menu-item>
        </el-menu>



        
          <router-link v-for="(item, index) in currentNavGroup" :to="item.path"  tag="li" :key="index" class="menu-list" >
            <span > {{item.title}}</span>
          </router-link>

          
      </ul>
    </div>
  </div>
</template>
<script type="text/javascript">
  export default {
    name: 'slide',
    data(){
      return {
        currentNavGroup:[]
      }
    },
    created(){
      this.getCurrentNavGroup();
    },
    watch: {
    '$route' (val, old) {
        this.getCurrentNavGroup();
      }
    },
    props:['nav'],
    methods:{
      getCurrentNavGroup(){
        let currentNavGroupPath='/'+this.$route.path.split('/')[1];
        for(let i=0;i<this.nav.length;i++){
          if(this.nav[i].path == currentNavGroupPath){
            this.currentNavGroup=this.nav[i].children;
          }
        }
      },
    },
  }
</script> 